Skip to content

Instantly share code, notes, and snippets.

@karpathy
karpathy / min-char-rnn.py
Last active May 10, 2024 18:13
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@xmonkee
xmonkee / vscode-theme.json
Created February 22, 2024 03:27
Default VSCode themes for Zed
{
"$schema": "https://zed.dev/schema/themes/v0.1.0.json",
"name": "Visual studio code themes",
"author": "Microsoft",
"themes":[
{
"name": "Light (Visual Studio)",
"appearance": "light",
"style": {
"border": null,
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 10, 2024 18:12
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@Yousha
Yousha / .gitignore
Last active May 10, 2024 18:12
.gitignore for C/C++ developers.
##### Windows
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
@pesterhazy
pesterhazy / building-sync-systems.md
Last active May 10, 2024 18:10
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@webketje
webketje / README.md
Last active May 10, 2024 18:09
Soundcloud Downloader Clean - Tampermonkey userscript OR bookmarklet

Tampermonkey userscript - Soundcloud Downloader Clean

An ad-less, multilingual, clean Soundcloud downloader with robust code. Adds a 'Download' button to all single track views.

Features

  • No third-party embeds, redirects or ads, directly uses the Soundcloud API.
@0xmjk
0xmjk / pyspark-df-lowercase.py
Created December 14, 2017 19:01
Make all column names in a DataFrame lowercase (PySpark)
# chain DataFrame.withColumnRenamed() calls for each df.schema.fields
df = reduce(lambda chain, column: chain.withColumnRenamed(*column),
map(lambda field: (field.name, str.lower(field.name)),
df.schema.fields),
df)
@ericmjl
ericmjl / ds-project-organization.md
Last active May 10, 2024 18:06
How to organize your Python data science project

UPDATE: I have baked the ideas in this file inside a Python CLI tool called pyds-cli. Please find it here: https://github.com/ericmjl/pyds-cli

How to organize your Python data science project

Having done a number of data projects over the years, and having seen a number of them up on GitHub, I've come to see that there's a wide range in terms of how "readable" a project is. I'd like to share some practices that I have come to adopt in my projects, which I hope will bring some organization to your projects.

Disclaimer: I'm hoping nobody takes this to be "the definitive guide" to organizing a data project; rather, I hope you, the reader, find useful tips that you can adapt to your own projects.

Disclaimer 2: What I’m writing below is primarily geared towards Python language users. Some ideas may be transferable to other languages; others may not be so. Please feel free to remix whatever you see here!

@wojteklu
wojteklu / clean_code.md
Last active May 10, 2024 18:05
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@dlovell
dlovell / dbg-nix-pkg.sh
Last active May 10, 2024 18:05
A helper function to `nix develop` on a package
# https://nixos.wiki/wiki/Nixpkgs/Create_and_debug_packages#Using_nix-shell_for_package_development
function debug_nix_package () {
set -u
packageName=${1:-default}
flakeDir=${2:-$(pwd)}
tmpdir=${3:-$(mktemp --directory --suffix=-nix-dbg)}
system=${4:-$(uname --machine)-$(uname --kernel-name | tr '[:upper:]' '[:lower:]')}
cd "$tmpdir" || exit
ln -s "$flakeDir" flakeDir